<template>
	<view class="activity_list">
		<view class="item" v-for="item in props.data" :key="item.id" @click="details(item)">
			<view class="left">
				<view class="price" v-if="item.price">
					<tagVue title="房东直租" :bgColor="backgroundColor3" :textColor="textColor3" />
				</view>
				<image :src="item.src" mode=""></image>
			</view>
			<view class="right" v-if="item.department">
				<text>{{ item.title }}</text>
				<view class="author">
					<text>{{ item.department }}</text>
					<text>{{ item.timer }}</text>
				</view>
			</view>
			<view class="right_price" v-else>
				<text>{{ item.title }}</text>
				<text style="color: #a79aa7;">{{ item.content }}</text>
				<text style="color: #f46363">￥{{ item.price }}/月</text>
			</view>
		</view>
	</view>
</template>

<script setup>
import { ref } from 'vue';
import tagVue from '@/components/tag.vue';
const props = defineProps(['data']);
const details = (item) => {
	if(item.department){
		uni.navigateTo({
			url: '/pages/articleDetail/articleDetail?id=' + item.id
		});
	}
	if(item.price){
		uni.navigateTo({
			url:"/pages/rentDetail/rentDetail"
		})
	}
};
const backgroundColor3 = ref('#2ed477');
const textColor3 = ref('#ffffff');
</script>

<style lang="scss">
.activity_list {
	width: 100%;
	.item {
		width: 100%;
		height: 210rpx;
		display: flex;
		align-items: center;
		justify-content: space-around;
		border: 2rpx solid #f2f2f2;
		border-radius: 20rpx;
		margin: 30rpx 0;
		.left {
			position: relative;
			.price {
				position: absolute;
				top: 0;
				left: 0;
			}
			image {
				width: 220rpx;
				height: 160rpx;
				border-radius: 10rpx;
			}
		}
		.right {
			width: 360rpx;
			height: 160rpx;
			display: flex;
			flex-direction: column;
			justify-content: space-between;
			.author {
				display: flex;
				align-items: center;
				justify-content: space-between;
				font-size: 28rpx;
				color: #aab2c8;
			}
		}
		.right_price {
			width: 360rpx;
			height: 160rpx;
			display: flex;
			flex-direction: column;
			justify-content: space-between;
		}
	}
}
</style>
